package in.srain.cube.util.general;

import in.srain.cube.util.internal.AppSupplier;

public class ObjectUtil {

    public static <T> T defaultIfNull(T obj, T fallback) {
        return obj != null ? obj : fallback;
    }

    public static <T> T defaultIfNull(T obj, AppSupplier<T> fallbackSupper) {
        return obj != null ? obj : fallbackSupper.get();
    }

    public static boolean isAnyEmpty(Object... objects) {
        for (Object o : objects) {
            if (o == null) {
                return true;
            }
        }
        return false;
    }
}
